

/*mob
	ai
		Click()
			if(get_dist(src, usr) <= 1)
				usr.attack(src)*/

mob
	proc
		ai()
		hit_by(mob/m)
		attack(mob/target)
			target.hit_by(src)


	ai
		var
			mob/target

		New()
			..()
			spawn(rand(10,20)) ai()

		ai()
			if(target)
				if(get_dist(src, target) > 1)
					step_to(src, target)
					attack2(target)
					sleep(5)
				else
					attack2(target)
					sleep(10)
			else
				// We try to acquire a target. If we get a target we
				// have a short delay before the next AI cycle. If we
				// don't get a target we continue wandering.
				get_target()
				if(target)
					sleep(5)
				else
					step_rand(src)
					sleep(20)

			spawn() ai()

		hit_by(mob/m)
			if(!target)
				target = m

		proc
			get_target()

		Goa
			icon_state = "goa"

			// get_target is responsible for setting the target variable.
			get_target()
				for(var/mob/m in oview(2, src))
					target = m
					return


mob
	ai
		icon = 'ai.dmi'

mob
	ai
		proc
			attack2()
	/*			if(Bump(target))
					target.health-=1
					if(target.health<=0) //the result of health-amount might not be 1.
						target.health=0 //try not to let things hit the negatives
						del(target)
				*/
				for(var/mob/m in oview(1, src))
					target.health-=1
					if(target.health<=0) //the result of health-amount might not be 1.
						target.health=0 //try not to let things hit the negatives
						target.respawn()


mob
	ai
		Click()
			src.health -= 1
			view() << "[usr] has hit [src]"
			if(src.health<=0) //the result of health-amount might not be 1.
				src.health=0 //try not to let things hit the negatives
			//	src.loc = /obj/items/Gold_Coins
				view() << "[src] has died!"
				del(src)